@extends('layouts.admin_iframe')
@section('content')
		<table class="table table-hover">
			<tr class="active">
			  <th width="100">属性id</th>
			  <th>属性名称</th>

				<th>属性类别</th>
				<th>属性值</th>
			  <th width="210">操作</th>
			</tr>
			@foreach($attr_datas as $adt)
			<tr>
				<td>{{$adt->aid}}</td>
				<td>{{$adt->aname}}</td>
				<td>{{$adt->atype}}</td>
				<td>{{$adt->avalue}}</td>
				<td>
					{{--<a href="{{url('admin/cate/create_son/'.$adt->cid.'/'.$adt->type_tid)}}" class="btn btn-sm btn-primary">添加子类</a>--}}
					<a href="{{url('admin/attr/'.$adt->aid.'/edit?tid='.$adt->type_tid)}}" class="btn btn-sm btn-warning">编辑</a>
					<a href="javascript:;" onclick="attr_del({{$adt->aid}})" class="btn btn-sm btn-danger">删除</a>
				</td>
			</tr>
				@endforeach
			<a href="{{url('admin/attr/create?tid='.$tid)}}" class="btn btn-sm btn-primary">添加属性</a>
		</table>
		<script>
			function attr_del(aid){
				layer.confirm('您确定要删除此分类吗？', {
					btn: ['确定','取消'] //按钮
				}, function(){
					$.post("{{url('admin/attr/')}}/" + aid, {'_token': '{{csrf_token()}}','_method': 'delete'}, function(db){
						if (db.status == 1) {
							window.location.reload();
							layer.msg(db.msg, {icon: 6});
						} else {
							layer.msg(db.msg, {icon: 5});
						}
					});
				}, function(){

				});
			}


		</script>
		<script>
			function order_change(obj,cate_id){
				var cate_order = $(obj).val();
				$.post("{{url('admin/cate/order_change')}}",{'_token':'{{csrf_token()}}','cid':cate_id,'sort':cate_order},function(data){
	//				alert(data.msg);
					if(data.status==1){
						layer.msg(data.msg, {icon: 6});
					}else{
						layer.msg(data.msg, {icon: 5});
					}
				});
			}
		</script>

@endsection
